document.getElementById('chooseImages').addEventListener('click', function() {
    var fileInput = document.createElement('input');
    fileInput.type = 'file';
    fileInput.multiple = true;
    fileInput.accept = 'image/*';

    fileInput.addEventListener('change', function() {
        var files = fileInput.files;
        if (files.length === 12) {
            var images = document.querySelectorAll('.container .box img');
            for (var i = 0; i < 12; i++) {
                var file = files[i];
                var reader = new FileReader();

                reader.onload = (function(imageIndex) {
                    return function(e) {
                        images[imageIndex].src = e.target.result;
                    };
                })(i);
                reader.readAsDataURL(file);
            }
        } else {
            alert('请选择12张图片进行替换');
        }
    });

    fileInput.click(); // 模拟点击文件选择框
});